package org.ltt.rbac.service.impl;

import org.ltt.rbac.model.User;
import org.ltt.rbac.service.UserService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @Author: dujun
 * @Date: 2020/6/4 15:43
 */
@Service
public class UserServiceImpl implements UserService {
    @Override
    public void createUser(UserDetails user) {

    }

    @Override
    public void updateUser(UserDetails user) {

    }

    @Override
    public void deleteUser(String username) {

    }

    @Override
    public void changePassword(String oldPassword, String newPassword) {

    }

    @Override
    public boolean userExists(String username) {
        return false;
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        User user = new User();
        if(!"admin".equals(username)){
            return user;
        }
        user.setUsername(username);
        user.setPassword("admin123");

        System.out.println("开始验证。。。 = " + username);
        return user;
    }
}
